﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVCBugTracker.Controllers;
using MVCBugTracker.Tests.Mocks;
using System.Web.Mvc;
using System.Web.Routing;

namespace MVCBugTracker.Tests.Controllers
{
    [TestClass]
    public class ProjectControllerTest
    {
        private static ProjectController GetProjectController()
        {
            ProjectController controller = new ProjectController()
            {
                ProjectRepository = new MockProjectRepository(MockData.CreateProjectData()),
                BugRepository = new MockBugRepository()
            };
            controller.ControllerContext = new ControllerContext()
            {
                Controller = controller,
                RequestContext = new RequestContext(new MockHttpContextAdmin(), new RouteData())
            };
            return controller;
        }

        [TestMethod]
        public void Project_Index_Returns_View()
        {
            // Arrange
            ProjectController controller = GetProjectController();

            // Act
            ActionResult result = controller.Index();

            // Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
    }
}
